package com.ecp.ws.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class PropertiesFileUtil {

	public String  getProperties(String propertiesFile,String key){

		InputStream inputstream = Thread.currentThread().getContextClassLoader().getResourceAsStream(propertiesFile);
		Properties p = new Properties();
		try {
			p.load(inputstream);
	
		} catch (Exception e) {
			return null;
		}
		finally{
			try{
				inputstream.close();
			}catch(IOException e){
				return null;
			}
		}
		int r = key.lastIndexOf("url");
		if(r >0){
			String ip = p.getProperty("serviceUrl");
			return ip+p.getProperty(key);
		}
		return p.getProperty(key);
	}
	
}
